<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <!-- BEGIN META -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Olive Enterprise">
    <!-- END META -->
    <title>员工自助修改信息审核页面</title>
    <link href="/Public/User/update/css/layui/src/css/layui.css" rel="stylesheet">
    <link rel="shortcut icon" type="image/x-icon"  href="/Public/User/update/img/ooopic_1497861131.ico">
    <!-- BEGIN STYLESHEET-->
    <link href="/Public/User/update/css/bootstrap3.3.4.css" rel="stylesheet">
    <link href="/Public/User/update/css/bootstrap-reset.css" rel="stylesheet">
    <link href="/Public/User/update/css/style.css" rel="stylesheet">
    <link href="/Public/User/update/css/style-responsive.css" rel="stylesheet">
    <link href="/Public/User/update/assets/morris.js-0.4.3/morris.css" rel="stylesheet">
    <link rel="stylesheet" href="/Public/User/css/ion.calendar.css">

    <script src="/Public/User/newjs/jquery.js"></script>
    <script src="/Public/User/update/css/layer/layer/layer.js" ></script>
    <link href="/Public/User/update/css/clndr.css" rel="stylesheet">
    <script src="/Public/User/page/js/bootstrap.min-3.0.3.js"></script>
    <script src="/Public/User/newjs/moment.min.js"></script>
    <script src="/Public/User/newjs/moment.zh-cn.js"></script>
    <!--[if lt IE 9]>
    <script src="/Public/User/update/js/html5shiv.js"></script>
    <script src="/Public/User/update/js/respond.min.js"></script>
    <![endif]-->
    <style>
        body{
            font-family: '微软雅黑';
            background: #fff;
        }
        .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td{
            line-height: 2.4285;
        }
        .control-label{
            width: 25%;
        }
        .col-sm-3{
            padding-left: 0px;
        }

        .col-sm-9{
            padding-left: 0px;
        }
        .yy{
            border:solid 1px black;
            color:black;
        }
        .sx{
            margin-right:50px;
            font-size:16px;
        }
        .sx input{
            width:16px;
            height:16px;
        }
        .zj input{
            width:13px;
            height:13px;
        }
        .menu_box ul li ul.sub_menu li {
            padding-left: 0;
        }
        .menu_box ul li ul.sub_menu li a {
            padding: 0;
            font-family:Microsoft YaHei, Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif !important;
            font-size: 12px !important;
        }
        .menu_box ul li h3{
            font-size: 15px;
            font-weight: bold;
        }
        .top_left{
            float: left;
        }
        .top_right>ul>li{
            margin-right: 0 !important;
            float: right;
        }
        .but{
            height:30px;
            font-size:12px !important;
            padding: 6px 12px;
            margin-bottom: 8px;
            font-weight: 400;
            line-height: 1.42857143;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
        }
        .btn-default{
            background-color: rgb(255, 255, 255);
            color: rgb(51, 51, 51);
            border-width: 1px;
            border-style: solid;
            border-color: rgb(208, 208, 208) rgb(208, 208, 208) rgb(204, 204, 204);
            border-right:none;
        }
        .btn-info{
            color: rgb(255, 255, 255);
            background-color:  #3383da;
            border:1px solid  #3383da;;
        }
        .btn-danger{
            color: rgb(255, 255, 255);
            background-color: #dc4f39;
            border:1px solid #dc4f39;
        }
        .top_box{
            border-bottom: 1px solid #d5d5d5;
            box-shadow: 0px 2px 1px #efefef;
            background: white;
            box-sizing: border-box;
            position: relative;
            clear: both;
            height:40px;
            line-height: 40px;
            /*background-color: #0097B4; ;*/
            /*background: #bae3f9;*/
        }
        .panel{
            clear:both;
        }
        .search_area {
            clear: both;
            border: 1px solid #d5d5d5;
            border-radius: 3px;
            margin-bottom: 6px;
        }

        .search_area_content {
            height: 35px;
            margin-top: 1px;
            background-color: rgb(248, 248, 248);
            clear: both;
        }

        .search_area_content span>.select_div, .search_area_content span>.input_div {
            display: inline-block;
            padding-top: 2px;
        }

        .search_area input, .search_area select {
            margin-left: 5px;
            border: 1px solid #ccc;
            color: #444;
            outline: none;
            padding: 4px;
            font-size: 13px;
            background: #fff;
        }

        .search_area input {
            width: 186px;
        }

        .search_area select {
            width: 184px;
        }

        .search_btn{
            height: 26px;
            padding: 3px 20px;
            margin: 2px 8px 3px 8px;
        }
    </style>
    <script>
        //初始化日历插件
        $(function () {
            //时间日期插件
            $('.date').each(function () {
                $(this).ionDatePicker({
                    lang: 'zh-cn',
                    format: 'YYYY-MM-DD',
                    years: '100'
                });
            });
        })

    </script>
</head>
<body>
<script src="/Public/User/newjs/ion.calendar.js"></script>
<!-- BEGIN PANEL SECTION -->
<div class="top_box">
    <div class="top_left" style="margin-left:20px;">
        <h4>个人信息历史审核记录</h4>
    </div>
    <div class="top_right" style="margin-right:80px">
        <ul>
            <li>
                <button class="but btn-info" style="font-size:14px;width:70px;" id="fh"  style="margin-left:50px;color:green;font-size:18px">返回</button>
            </li>
        </ul>
    </div>
</div>
<div class="search_area">
    <div class="search_area_content">
        <form action="/Pc/Check/history" method="get">
            <input type="hidden" name="uuid" value="<?php echo $uuid; ?>">
            <span style="margin-left:20px;margin-right:15px;font-size:12px; font-weight:bold">按条件检索</span>
            <span style="margin-right:15px;">审批状态
                <div class="select_div">
                     <select name="sp_type">
                         <?php $sp_type=I('get.sp_type');?>
                         <option value="">请选择</option>
                         <option value="1" <?php if($sp_type==1) echo 'selected';?>>审批中</option>
                         <option value="2" <?php if($sp_type==2) echo 'selected';?>>审批结束</option>
                     </select>
                </div>
            </span>
            <span style="margin-right:15px;">子集名称
                <div class="select_div">
                    <select name="menu">
                        <option value="">请选择</option>
                        <?php $menu=I('get.menu'); foreach($menus as $k=>$v){ if($v['display']){ ?>
                        <option value="<?php echo $v['name'];?>" <?php if($v['name']==$menu) echo 'selected';?>><?php echo $v['caption'];?></option>
                        <?php }} ?>
                    </select>
                </div>
            </span>
            <span style="margin-right:20px;">起止时间
                <div class="input_div">
                    <?php $ks_sj=I('get.ks_sj');$js_sj=I('get.js_sj');?>
                    <input class="date" name="ks_sj" value="<?php echo $ks_sj;?>" type="text"> ----
                    <input class="date" name="js_sj" value="<?php echo $js_sj;?>" type="text">
                </div>
            </span>
            <span>
                <input  type="submit" class="but btn-info search_btn" value="搜索">
            </span>
        </form>
    </div>
</div>
<section class="panel " >
    <?php if(!$info){ ?>
        <div style="margin-left:20px;color:red"><p>根据您的搜索条件未查询到数据,请重新输入搜索条件!</p></div>
    <?php }else{ foreach($info as $k=>$v){ ?>
    <div style="margin-bottom:20px">
        <div class="adv-table">
            <div style="padding:5px 0 5px 10px ;">
                <span style="font-size:16px;">提交审批时间 : <?php echo date('Y-m-d H:i',$v['time']);?></span>&nbsp;&nbsp;&nbsp;
                <span style="font-size:16px;">审批状态 : <?php echo $v['sp_bz']?'审批结束':'审批中'; ?></span>
            </div>
            <!-------------------------员工基本信息开始---------------------------------->
            <?php if($v['base_info']){ ?>
            <div style="overflow: auto;" class="col">
                <table  class="table table-bordered" >
                    <tr>
                        <td style="background: #669acc; color: #fff; padding: 2px; " >
                            <h4 title="zijibaioji" style="float: left;"><?php echo $v['base_info']['caption'];?></h4>
                        </td>
                    </tr>
                    <!---------------------字段名------------------------->
                    <tr>
                        <th><div style="width: 60px; text-align: center;"></div>审批结果</th>
                        <th><div style="width: 30px; text-align: center;"></div>类型</th>
                        <?php foreach($v['base_info']['sublist'] as $h=>$j){ ?>
                        <th><?php echo $j['caption'];?></th>
                        <?php } ?>
                    </tr>
                    <!---------------------数据--------------------------->
                    <?php if(!$v['sp_bz']){ $sp_jg = ''; }elseif($v['base_info'] && $v['base_info']['sp_info']['sp_type']==1){ $sp_jg = '通过'; }elseif($v['base_info'] && $v['base_info']['sp_info']['sp_type']==0){ $sp_jg = '不通过'; } ?>
                    <tr class="gradeX">
                        <td style="width:60px"><?php echo $sp_jg; ?></td>
                        <td >更改</td>
                        <?php foreach($v['base_info']['sublist'] as $h=>$j){ ?>
                        <td>
                            <input type="text" class="up" style="color:red" zd_name="<?php echo $j['caption']; ?>" oldval="<?php echo $j['oldvalue'];?>" value="<?php echo $j['value'];?>" readonly>
                        </td>
                        <?php } ?>
                    </tr>
                    <?php if(!$v['sp_bz']){ $style='style="display:none"'; }else{ if($v['base_info']['sp_info']['sp_type'] == 0){ $style='style="display:black"'; }elseif(!$v['base_info'] || $v['base_info']['sp_info']['sp_type']==1){ $style='style="display:none"'; } } ?>
                    <tr <?php echo $style;?>>
                    <td class="col-sm-3 col-sm-3 control-label"  colspan="15">
                        <div style="float:left;color:red">不通过意见:　</div>
                        <div style="float:left;width:1200px;color:red">
                            <input class="form-control yy" value="<?php  echo $v['base_info']['sp_info']['reason'];?>" type="text" readonly>
                        </div>
                    </td>
                    </tr>
                </table>
            </div>
            <?php } ?>
            <!-------------------------员工基本信息结束---------------------------------->

            <!-------------------------扩展子集开始---------------------------------->
            <?php foreach($v['zj_info'] as $k1=>$v1){ $val = $v1['value']; $keys = array_keys($val); ?>
            <div style="overflow: auto;" class="col">
                <table  class="table table-bordered" >
                    <tr>
                        <td style="background: #669acc; color: #fff; padding: 2px; " >
                            <h4 title="zijibaioji" style="float: left;"><?php echo $v1['caption'];?></h4>
                        </td>
                    </tr>
                    <!---------------------字段名------------------------->
                    <tr>
                        <th><div style="width: 60px; text-align: center;"></div>审批结果</th>
                        <th><div style="width: 30px; text-align: center;"></div>类型</th>
                        <th><div style="width: 30px; text-align: center;"></div>序号</th>
                        <?php foreach($val[$keys[0]]['info'] as $h=>$j){ ?>
                        <th><?php echo $j['caption'];?></th>
                        <?php } ?>
                    </tr>
                    <!---------------------数据--------------------------->
                    <?php $xuhao = 0; foreach($val as $f=>$g){ $xuhao++; if($g['type']=='insert'){ $type_name = '新增'; }elseif($g['type']=='update'){ $type_name = '更改'; }else{ $type_name = '删除'; } if(!$v['sp_bz']){ $sp_jg = ''; }else if($g['sp_info'] && $g['sp_info']['sp_type']==1){ $sp_jg = '通过'; }elseif($g['sp_info'] && $g['sp_info']['sp_type']==0){ $sp_jg = '不通过'; } ?>
                    <tr class="gradeX">
                        <td ><?php echo $sp_jg; ?></td>
                        <td ><?php echo $type_name; ?></td>
                        <td><?php echo $xuhao;?></td>
                        <?php foreach($g['info'] as $a=>$b){ if($b['change_type']==1 && $g['type']=='update'){ $style = 'style="color:red"'; $class = 'class="up"'; }else{ $style = ''; $class = ''; } ?>
                        <td>
                            <input type="text" <?php echo $style; echo $class; ?> zd_name="<?php echo $b['caption']; ?>" oldval="<?php echo $b['oldvalue'];?>" value="<?php echo $b['value'];?>" readonly>
                        </td>
                        <?php } ?>
                    </tr>
                    <?php if($g['sp_info'] && $g['sp_info']['sp_type']==0){ $style='style="display:black"'; }else{ $style='style="display:none"'; } ?>
                    <tr <?php echo $style;?>>
                    <td class="col-sm-3 col-sm-3 control-label"  colspan="15">
                        <div style="float:left;color:red">不通过意见:　</div>
                        <div style="float:left;width:1200px;color:red">
                            <input class="form-control yy" value="<?php  echo $g['sp_info']['reason'];?>" type="text" readonly>
                        </div>
                    </td>
                    </tr>
                    <?php } ?>
                </table>
            </div>
            <?php } ?>
        <!-------------------------扩展子集结束---------------------------------->
        </div>
    </div>
    <?php }} ?>
</section>
<div class="container" style="text-align:center">
    <div id="page" page="<?php echo I('get.page')?I('get.page'):1;?>"></div>
    <nav aria-label="Page navigation">
        <ul class="pagination" id="pagination"></ul>
    </nav>
</div>
</body>
<script>
    $(function(){
        var col = $('.col').find('table').find('tr:eq(1)').find('th');
        $('.col').find('table').find('tr:eq(0)').find('td:eq(0)').attr('colspan',col.length);
        $('.col').find('table').find('tr:last').find('td:eq(0)').attr('colspan',col.length);

        $('.shows').parents('table').find('tr:gt(0)').hide();

        /****************************查看修改之前的数据***************************/
        $('.up').click(function(){
            var zd_name = $(this).attr('zd_name');
            var oldval = $(this).attr('oldval');
            var val = $(this).val();
            layer.open({
                type: 1,
                title: false, //不显示标题栏
                closeBtn: false,
                area: '400px;',
                shade: 0.8,
                id: 'LAY_layuipro', //设定一个id，防止重复弹出
                btn: ['确定'],
                moveType: 1 ,//拖拽模式，0或者1
                content: '<div style="padding: 50px;line-height:22px;color:black;"><div style="text-align:center;font-size:18px;"><span>'+zd_name+'</span></div><br><div class="form-group"><label class="col-sm-3 col-sm-3 control-label">修改后</label><div class="col-sm-9"><input style="color:black;" class="form-control" value="'+val+'" type="text" readonly></div></div><br><div class="form-group"><label class="col-sm-3 col-sm-3 control-label" >修改前</label><div class="col-sm-9"><input class="form-control" style="color:black;" type="text" value="'+oldval+'" readonly></div></div>',
                success: function(layero){
                    var btn = layero.find('.layui-layer-btn');
                    btn.css('text-align', 'center');
                }
            });
        })
        $('#fh').click(function(){
            var uuid = '<?php echo ($uuid); ?>';
            location.href = '/Pc/Pc/index/id/'+uuid;

        })
        //时间日期插件
        $('.date').each(function () {
            $(this).ionDatePicker({
                lang: 'zh-cn',
                format: 'YYYY-MM-DD',
                years: '100'
            });
        });

        //检测搜索时间
        $('.search_btn').click(function(){
            var ks_sj   = $('input[name=ks_sj]').val();
            var js_sj   = $('input[name=js_sj]').val();
            if((ks_sj && !js_sj) || (!ks_sj && js_sj)){
                layer.alert('起止时间不能有一个为空!');
                return false;
            }else if(ks_sj && js_sj){
                if(js_sj <= ks_sj){
                    layer.alert('结束时间不能小于或等于开始时间!');
                    return false;
                }
            }
        });

        //分页
        var info = "<?php echo ($info); ?>";
        var z_count = parseInt(<?php echo ($count); ?>);
        if(info && z_count>1){
            window.pagObj = $('#pagination').twbsPagination({
                totalPages: z_count,
                visiblePages: 10,
                onPageClick: function (event, page) {
                    console.info(page + ' (from options)');
                }
            }).on('page', function (event, page) {
                console.info(page + ' (from event listening)');
                var getinfo = getUrlKey();
                if(getinfo){
                    location.href = '/Pc/Check/history/uuid/9999002122/'+getinfo+'/page/'+page;
                }else{
                    location.href = '/Pc/Check/history/uuid/9999002122/page/'+page;
                }
            });

        }
    });

    //整理分页链接的参数
    function getUrlKey(){
        var sp_type = "<?php echo I('get.sp_type');?>";
        var menu    = "<?php echo I('get.menu');?>";
        var ks_sj   = "<?php echo I('get.ks_sj');?>";
        var js_sj   = "<?php echo I('get.js_sj');?>";
        if(sp_type && menu && ks_sj){
            var getinfo = 'sp_type/'+sp_type+'/menu/'+menu+'/ks_sj/'+ks_sj+'/js_sj/'+js_sj;
        }else if(sp_type && menu){
            var getinfo = 'sp_type/'+sp_type+'/menu/'+menu;
        }else if(menu && ks_sj){
            var getinfo = 'menu/'+menu+'/ks_sj/'+ks_sj+'/js_sj/'+js_sj;
        }else if(sp_type && ks_sj){
            var getinfo = 'sp_type/'+sp_type+'/ks_sj/'+ks_sj+'/js_sj/'+js_sj;
        }else if(sp_type){
            var getinfo = 'sp_type/'+sp_type;
        }else if(menu){
            var getinfo = 'menu/'+menu;
        }else if(ks_sj){
            var getinfo = 'ks_sj/'+ks_sj+'/js_sj/'+js_sj;
        }
        return getinfo;
    }
</script>
<?php if($info):?>
<script src="/Public/User/page/jquery.twbsPagination.js"></script>
<?php endif;?>
</html>